﻿using IceDog.JsonDotNet.Model.NewJsonConverter;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IceDog.JsonDotNet.Model
{
    public enum UserStatus
    {
        NotConfirmed,
        Active,
        Deleted
    }

    //[JsonConverter(typeof(UserConverter))]
    [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
    //DefaultNamingStrategy SnakeCaseNamingStrategy CamelCaseNamingStrategy
    public class User
    {
        [JsonConverter(typeof(StringEnumConverter))]
        public UserStatus Status { get; set; }

        public string Name { get; set; }
        public string Password { get; private set; }
        public bool Enabled { get; private set; }
        [JsonProperty(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
        public int SnakeRating { get; set; }
        [JsonProperty(NamingStrategyType = typeof(DefaultNamingStrategy))]
        public int DefaultRating { get; set; }
        public int ProPoeA { get; set; }
        public string ProPoeBs { get; set; }
        [JsonProperty(PropertyName = "UPN")]
        public string Upn { get; set; }
        public User()
        {

        }
        //告诉json.net使用哪个构造函数进行反序列化
        [JsonConstructor]
        
        public User(string name, bool enabled)
        {
            Name = name;
            Enabled = enabled;
        }
    }
}
